package com.ruoyi.constant;

/**
 * 角色枚举
 */
public enum RoleEnum {

    ADMIN("admin","超级管理员"),
    MANAGER("manager","管理员"),
    OPERATOR("operator","操作员");

    private String code;
    private String desc;

    RoleEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(String code) {
        for (RoleEnum value : RoleEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getDesc();
            }
        }
        return null;
    }

    public static boolean ifExist(String csbs) {
        for (CsbsEnum value : CsbsEnum.values()) {
            if (value.getCode().equals(csbs)) {
                return true;
            }
        }
        return false;
    }

}
